<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/jsp/component/common.jsp" %>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>详细内容</title>
	<link rel="stylesheet" href="${frames}/css/lib/bootstrap.min.css" type="text/css" type="text/css">
	<link rel="stylesheet" href="${newframe}/css/base/base.css" type="text/css">
	<link rel="stylesheet" href="${newframe}/css/common.css" type="text/css">
	<!--[if IE 8]>
	<link rel="stylesheet" href="${newframe}/css/base/IE8.css" type="text/css"/>
	<![endif]-->
	<%@ include file="/WEB-INF/jsp/component/commonBottom.jsp" %>
	<script src="${assets}/bootstrapValidator/js/bootstrapValidator.js"></script>
	<script src="${assets}/bootstrapValidator/js/language/zh_CN.js"></script>
	<script>
		$(document).ready(function() {


			$('#myForm').bootstrapValidator({
				message: 'This value is not valid',
				feedbackIcons: {
					valid: 'glyphicon glyphicon-ok',
					invalid: 'glyphicon glyphicon-remove',
					validating: 'glyphicon glyphicon-refresh'
				},
				fields: {
					hospShortName: {
						validators: {
							notEmpty: true
						}
					},
					hospType: {
						validators: {
							notEmpty: true
						}
					},
					hospAddr: {
						validators: {
							notEmpty: true
						}
					}
				}
			}).on('success.form.bv', function (e) {
				e.preventDefault();
				$.ajax({
					url:'${URL_BASE_UPDATEHOSP}',
					type:'post',
					data:$('#myForm').serialize(),
					async : false, //默认为true 异步
					dataType : 'json',
					error:function(){
						alert('error');
					},
					success:function(data){

						if(!data.success){
							alert('保存失败，失败原因：'+data.msg);
						}
						closeFrame();

					}
				});
			});
		});
		//关闭并刷新
		function closeFrame(){
			window.parent.closeModal();
		}
	</script>
</head>
<body style="width: 98%">
<form id="myForm" class="form-horizontal" method="post" >
	<input type="hidden" id="hospId" name="hospId" value="${entity.hospId}" />
	<div class="clearfix">
		<div class="form-group col-sm-6">
			<label class="col-sm-4 control-label">医院简称</label>
			<div class="col-sm-8">
				<input type="text" id="hospShortName" name="hospShortName" class="form-control"  value="${entity.hospShortName}">
			</div>
		</div>
		<div class="form-group col-sm-6">
			<label class="col-sm-4 control-label">医院全称</label>
			<div class="col-sm-8">
				<input type="text" id="hospName" name="hospName" class="form-control" value="${entity.hospName}">
			</div>
		</div>
		<div class="form-group col-sm-6">
			<label class="col-sm-4 control-label">地区编码</label>
			<div class="col-sm-8">
				<input type="text" id="areaCode" name="areaCode" class="form-control" value="${entity.areaCode}">
			</div>
		</div>
		<div class="form-group col-sm-6 selectForm">
			<label class="col-sm-4 control-label">医院类型</label>
			<div class="col-sm-8">
				<select id="hospType" name="hospType" class="form-control">
					<medi:configOpt name="hospType" key="${entity.hospType}"/>
				</select>
			</div>
		</div>
		<div class="form-group col-sm-6">
			<label class="col-sm-4 control-label">地址</label>
			<div class="col-sm-8">
				<input type="text" id="hospAddr" name="hospAddr" class="form-control" value="${entity.hospAddr}">
			</div>
		</div>
		<div class="form-group col-sm-6">
			<label class="col-sm-4 control-label">联系人</label>
			<div class="col-sm-8">
				<input type="text" id="contactMan" name="contactMan" class="form-control" value="${entity.contactMan}">
			</div>
		</div>
		<div class="form-group col-sm-6">
			<label class="col-sm-4 control-label">联系电话</label>
			<div class="col-sm-8">
				<input type="text" id="contactTel" name="contactTel" class="form-control" value="${entity.contactTel}">
			</div>
		</div>
	</div>
	<div class="modal-footer" style="text-align: center ">
		<button type="button" class="btn btn-default" data-dismiss="modal" id="closeModalButt" onclick="closeFrame()">关闭</button>
		<button type="submit" class="btn btn-primary">保存</button>
	</div>
</form>

</body>
</html>